package cn.edu.javaweb.superServlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.edu.javaweb.utils.DBUtil;
@WebServlet("/UpdateCollageAdmin")
public class UpdateCollageAdmin extends HttpServlet {
	private static final long serialVersionUID = 1L;
	DBUtil db; //声明对象 一定要赋值  否则空指针异常
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id=request.getParameter("id");

		db=new DBUtil(); //建创对象 搭桥配置初始化
		db.init();
		String sql="update user set password='123456' where id='"+id+"'"; //写入sql语句
		int result = db.update(sql);
		System.out.println(sql); 
		request.getRequestDispatcher("/SelectCollageAdmin").forward(request, response);
	}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	} 

}
